#include"Sort.h"
void testtime() {
	srand(time(0));
	int n = 10000;
	datatype* a1 = (datatype*)malloc(sizeof(datatype) * n);
	datatype* a2 = (datatype*)malloc(sizeof(datatype) * n);
	datatype* a3 = (datatype*)malloc(sizeof(datatype) * n);
	datatype* a4 = (datatype*)malloc(sizeof(datatype) * n);
	datatype* a5 = (datatype*)malloc(sizeof(datatype) * n);
	datatype* a6 = (datatype*)malloc(sizeof(datatype) * n);
	datatype* a7 = (datatype*)malloc(sizeof(datatype) * n);
	datatype* a8 = (datatype*)malloc(sizeof(datatype) * n);
	
	for (int i = 0; i < n; i++) {
		a1[i] = rand();
		a2[i] = a1[i];
		a3[i] = a1[i];
		a4[i] = a1[i];
		a5[i] = a1[i];
		a6[i] = a1[i];
		a7[i] = a1[i];
		a8[i] = a1[i];
	}

	int begin1 = clock();
	InsertSort(a1, n);
	int end1 = clock();
	printf("InsertSort:%d\n", end1 - begin1);

	int begin2 = clock();
	ShellSort(a2, n);
	int end2 = clock();
	printf("ShellSort:%d\n", end2 - begin2);

	int begin3 = clock();
	SelectSort(a3, n);
	int end3 = clock();
	printf("SelectSort:%d\n", end3 - begin3);

	int begin4 = clock();
	HeapSort(a1, n);
	int end4 = clock();
	printf("HeapSort:%d\n", end4 - begin4);

	int begin5 = clock();
	QuickSort(a5, n);
	int end5 = clock();
	printf("QuickSort:%d\n", end5 - begin5);

	int begin6 = clock();
	MergeSort(a6, n);
	int end6 = clock();
	printf("MergeSort:%d\n", end6 - begin6);

	int begin7 = clock();
	BublleSort(a7, n);
	int end7 = clock();
	printf("BublleSort:%d\n", end7 - begin7);

	int begin8 = clock();
	CountSort(a8, n);
	int end8 = clock();
	printf("CountSortSort:%d\n", end8 - begin8);
}
void testresult() {
	srand(time(0));
	int n = 11;
	datatype* a = (datatype*)malloc(sizeof(datatype));
	for (int i = 0; i < n; i++) {
		a[i] = rand()%100;
	}
	QuickSortNonR(a, n);
	print(a, n);
}
int main()
{
	//testtime();
	testresult();
	return 0;
}



